[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
##############################################################################
###+-----------+##############################################################
#+-| PICK_LIST |---------------------------------------------------+##########
#| +-----------+ Displays a pick list at the specified coordinates |##########
#+-----------------------------------------------------------------+##########
##############################################################################
##############################################################################
#+--| Summary |--------------+################################################
#| #INCLUDE pick.hdr |################################################
#+---------------------------+################################################
##############################################################################
##############################################################################
#+--| Syntax |-------------------------------+################################
#| PROCEDURE pick_list PROTOTYPE |################################
#| PARAMETERS VALUE LONG plist,; |################################
#| VALUE INT upper_row,; |################################
#| VALUE INT upper_col,; |################################
#| VALUE INT lower_row,; |################################
#| VALUE INT lower_col,; |################################
#| INT return_value,; |################################
#| VALUE LOGICAL display_only,; |################################
#| VALUE LOGICAL return_on_key |################################
#+-------------------------------------------+################################
##############################################################################
##############################################################################
#########+---| Description |----------------------------------------+#########
#########| This procedure displays a pick list at the specified |#########
#########| coordinates upper_row, upper_col, lower_row, lower_col. |#########
#########| When the user presses enter, the item selected is |#########
#########| returned to return_value. return_value is to be the Nth |#########
#########| item inserted into the pick list. |#########
#########| -------------------------------------------------------- |#########
#########| If the escape key is pressed, then return_value returns |#########
#########| zero. (0) |#########
#########| -------------------------------------------------------- |#########
#########| If display_only is set to TRUE then pick_list displays |#########
#########| the list and returns immediately. |#########
#########| -------------------------------------------------------- |#########
#########| If return_on_key is TRUE, pick_list returns if any key |#########
#########| other than a cursor/page movement key is pressed. The |#########
#########| return_on_key parameter allows you to monitor other keys |#########
#########| while the cursor/page keys are processed by pick_list. |#########
#########+----------------------------------------------------------+#########
##############################################################################
##############################################################################
#########+--| Example 1 |-------------------------------------------+#########
#########| * Have the 1st item in the pick list be an "ADD" |#########
#########| * parameter. If the user selects "ADD" then more |#########
#########| * elements are to be entered into the pick list |#########
#########| * for him/her to choose. |#########
#########| |#########
#########| z = 0 |#########
#########| DO WHILE z = 0 |#########
#########| |#########
#########| pick_list( pl,r,c,rr,cc,z,.F.,.F. ) |#########
#########| |#########
#########| *--- add 10 more items to the list |#########
#########| |#########
#########| IF z = 1 |#########
#########| FOR tc = tc TO tc + 10 |#########
#########| pick_add( pl, names[ tc ] ) |#########
#########| NEXT |#########
#########| z = 0 |#########
#########| ENDIF |#########
#########| ENDDO |#########
#########+----------------------------------------------------------+#########
##############################################################################
##############################################################################
#########+--| Example 2 |-------------------------------------------+#########
#########| * To better manage multiple pick list, use |#########
#########| * arrays to store the cursor positions. |#########
#########| |#########
#########| q = current_list |#########
#########| pick_list( p,r,[q],r[q+1],r[q+2],r[q+3],v,.F.,.F. ) |#########
#########+----------------------------------------------------------+#########
##############################################################################
##############################################################################
#########+--| Example 3 |-------------------------------------------+#########
#########| * Use the "display only" parameter to display a |#########
#########| * pick list, yet still enter data into a GET. |#########
#########| |#########
#########| VARDEF PRIVATE && All procedures/functions |#########
#########| && in the same .PRG file |#########
#########| && can access variables. |#########
#########| |#########
#########| LOGICAL shown = .F. |#########
#########| INT pvalue |#########
#########| ENDDEF |#########
#########| |#########
#########| FUNCTION INT get_filter |#########
#########| IF lastkey() = &K_F2 .AND. .NOT. shown |#########
#########| pick_list(k,row(),col(),row()+9,col()+9,; |#########
#########| pvalue,.F.,.T.) && show list only |#########
#########| shown = .T. |#########
#########| ENDIF |#########
#########| RETURN lastkey() |#########
#########| ENDIF |#########
#########| |#########
#########| {...} |#########
#########| @ 2,4 ?? "Press F2 to see list again." |#########
#########| @ 3,4 SAY "Account code: "GET accnt_code; |#########
#########| FILTER get_filter() ID d |#########
#########+----------------------------------------------------------+#########
##############################################################################
##############################################################################
#########+--| Example 4 |-------------------------------------------+#########
#########| * Use the "return_on_key" parameter to manage two |#########
#########| * or more pick lists at one time. In this case, a |#########
#########| * right arrow goes to the next "higher" pick list, |#########
#########| * while a left arrow goes to the next "lower" list. |#########
#########| * The pick list manager handles up/down cursor/page |#########
#########| * keys, returns on left/right keys. |#########
#########| |#########
#########| REPEAT |#########
#########| pick_list(pl[i],r[i],c[i],r1[i],r2[i],pkval,.T.,.F.) |#########
#########| |#########
#########| *--- look at the last keystroke |#########
#########| |#########
#########| DO CASE |#########
#########| |#########
#########| *--- right arrow key |#########
#########| CASE lastkey() = &K_RIGHT |#########
#########| i = i + 1 |#########
#########| IF i = 4 |#########
#########| i = 0 |#########
#########| ENDIF |#########
#########| |#########
#########| *--- left arrow key |#########
#########| CASE lastkey() = &K_LEFT |#########
#########| IF i = 0 |#########
#########| i = 5 |#########
#########| ENDIF |#########
#########| i = i - 1 |#########
#########| ENDCASE |#########
#########| UNTIL lastkey() = &K_ENTER |#########
#########+----------------------------------------------------------+#########
##############################################################################
See Also:
pick_add
pick_clear
pick_init()
pick_str()
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson